#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
#define max 5
#define Maxsize 10 
//typedef struct stu {
//	int data[max];
//	int length;
//
//}stu;
//
//void fun(stu* &arr) {
//	int len = arr->length - 1;
//	int i = 0;
//	int ret = 0;
//	while (i < len) {
//		ret = arr->data[i];
//		arr->data[i] = arr->data[len];
//		arr->data[len] = ret;
//		i++;
//		len--;
//	}
//}
//
//
//
//int main()
//{
//	stu* arr = (stu*)malloc(sizeof(stu));
//	arr->data[0] = 1;
//	arr->data[1] = 2;
//	arr->data[2] = 3;
//	arr->data[3] = 4;
//	arr->data[4] = 5;
//	arr->length = 5;
//	int len = arr->length;
//
//	for (int i = 0; i < len; i++) {
//
//		printf("%d  ", arr->data[i]);
//
//	}
//	printf("\n");
//	fun(arr);
//	for (int i = 0; i < len; i++) {
//
//		printf("%d  ", arr->data[i]);
//
//	}
//
//
//	return 0;
//}

typedef struct stu {
	int data;
	struct stu* next;
}stu;




int findmax(stu* L) {
	stu* h = L->next;
	int i = 1;
	int maxi = 1;
	int maxval = h->data;
	h = h->next;

	while (h != NULL) {
		i++;
		if (maxval < h->data) {
			maxi = i;
			maxval = h->data;
		}
		h = h->next;
	}
	return maxi;

}

stu* create() {
	stu* head;
	
	stu* a = (stu*)malloc(sizeof(stu));
	a->data = 2;
	stu* b = (stu*)malloc(sizeof(stu));
	b->data = 2;
	stu* c = (stu*)malloc(sizeof(stu));
	c->data = 3;
	stu* d = (stu*)malloc(sizeof(stu));
	d->data = 4;
	stu* e = (stu*)malloc(sizeof(stu));
	e->data = 5;
	stu* ret = (stu*)malloc(sizeof(stu));
	head = ret;
	a->next = b;
	b->next = c;
	c->next = d;
	d->next = e;
	e->next = NULL;
	ret->next = a;
	return head;
}

void yd(stu* & L) {
	stu* p = L->next, * q = p;
	while (p != NULL) {
		if (p->data < 0) {
			q->next = p->next;
			p->next = L->next;
			L->next = p;
			p = q->next;
		}
		else {
			q = p;
			p = p->next;
		}
	}

}

void display(stu* L) {
	stu* p = L->next;
	while ( p != NULL) {
		printf("%d ", p->data);
		p = p->next;
	}
	printf("\n");
}
void fk(stu*& A, stu*& B) {
	stu* p = A->next;
	B = (stu*)malloc(sizeof(stu));
	B->next = NULL;
	stu* ra = A, * rb = B;
	while (p != NULL) {
		if (p->data % 2 == 0) {
			p = p->next;
			ra = ra->next;
		}
		else
		{
			ra->next = p->next;
			rb->next = p;
			rb = rb->next;
			p = ra->next;
		}
	}
	rb->next = NULL;
}


bool match(char exp[], int n) {
	char arr[Maxsize];
	int top = -1;
	int i = 0 ;
	bool tag = true;
	while (i < n && tag == true) {
		if (exp[i] == '(' || exp[i] == '[' || exp[i] == '{')
		{
			top++;
			arr[top] = exp[i];
		}
		if (exp[i] == ')') {
			if (top >= 0 && arr[top] == '(') {
				top--;
			}
			else {
				tag = false;
			}
		}
		if (exp[i] == '}') {
			if (top >= 0 && arr[top] == '{') {
				top--;
			}
			else {
				tag = false;
			}
		}
		if (exp[i] == ']') {
			if (top >= 0 && arr[top] == '[') {
				top--;
			}
			else {
				tag = false;
			}
		}
		i++;
		
	}
	if (top >= 0)return false;
	return true;

}

int main() {
	

	return 0;
}

